[id].astro (763B)
1 --- 2 import Base from '../../layouts/Base.astro' 3 4 import { getCollection, render } from 'astro:content' 5 6 export async function getStaticPaths() { 7 const posts = await getCollection('blog') 8 9 return posts.map((post) => ({ 10 params: { 11 id: post.id, 12 }, 13 props: { 14 post, 15 }, 16 })) 17 } 18 19 const { post } = Astro.props 20 const { Content } = await render(post) 21 --- 22 23 <Base title={post.data.title}> 24 <div class="flex flex-col gap-6 [&_a]:text-blue-800 [&_a]:underline"> 25 <div class="flex flex-col gap-2"> 26 <span class="flex flex-col gap-1"> 27 <span class="text-sm font-light">{post.data.date.toDateString()}</span> 28 <span class="text-gray-600 italic">{post.data.desc}</span> 29 </span> 30 </div> 31 <Content /> 32 </div> 33 </Base>